<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" type="text/css" href="<%=path %>/static/css/css.css?1" />
<link rel="stylesheet" type="text/css" href="<%=path %>/static/jquery-ui/jquery-ui.min.css" />
<script type="text/javascript" src="<%=path %>/static/js/json2.js"></script>
<script type="text/javascript" src="<%=path %>/static/js/jquery.js"></script>
<script type="text/javascript" src="<%=path %>/static/jquery-ui/jquery-ui.min.js"></script>
<script type="text/javascript" src="<%=path %>/static/layer/layer.js"></script>
<script type="text/javascript" src="<%=path %>/static/utf8-jsp/ueditor.config.js"></script>
<script type="text/javascript" src="<%=path %>/static/utf8-jsp/ueditor.all.js"></script>
<script type="text/javascript" src="<%=path %>/static/js/gridview.js?v=1"></script>
<script type="text/javascript" src="<%=path %>/static/js/formview.js?v=1"></script>
<script type="text/javascript" src="<%=path %>/static/js/tool.js"></script>
<script type="text/javascript" src="<%=path %>/static/js/validate.js"></script>

<SCRIPT type="text/javascript">
    <!--
    var formSetting = {
    		po:'User',
    		title:"广告主编辑",
    		formid:"formedit",
    		hiddens:["id","type","password","totalFund","availFund","blockFund","createUser","createDateTime","modifyUser","modifyDateTime","state"],
    	fields:[
    	     [
    	        {tdwidth:100,title:"账号",type:"text",name:"userCode",width:150,datatype:"Require",msg:"请输入账号！"}
    		 ],
             [
                {title:"姓名",type:"text",name:"name",width:150,datatype:"Require",msg:"请输入姓名！"}
             ],
             [
                {title:"手机",type:"text",name:"mobileno",width:150,datatype:"Tel",msg:"请输入格式正确的手机！"}
             ],
             [
             	{title:"公司名称",type:"text",name:"companyName",width:150,datatype:"Require",msg:"请输入公司名称！"}
             ],
             [
                {title:"营业执照",type:"uploadimg",name:"busLicense",width:100}
             ],
             [
                {title:"其他资质",type:"uploadimg",name:"otherQualifi",width:100}
             ],
             [
                {title:"备注",type:"text",name:"note",width:600}
             ]
             ],
		toolbar:{align:'right',buttons:[
		                 			  {
		                 			    	 id:'save',
		                 			    	 title:'保存',
		                 			    	 handlers:{
		                 			    		 click: function(){
		                 			    			 if(!Validator.Validate(document.getElementById('formedit'),0)){
		                 			    			    return;
		                 			    			 }
		                 			    			 $("input[name=type]").val("B");
		                 			    			 if($("input[name=totalFund]").val()==""){
		                 			    			     $("input[name=totalFund]").val(0);
		                 			    			 }
		                 			    			 if($("input[name=availFund]").val()==""){
                                                     	 $("input[name=availFund]").val(0);
                                                     }
		                 			    			 if($("input[name=blockFund]").val()==""){
                                                         $("input[name=blockFund]").val(0);
                                                     }
		                 			    			 if($("input[name=id]").val()==""){
		                 			    			     $.getJSON(g_path+"/public/common/chkUserCode.htmls",{userCode:$("input[name=userCode]").val()},function(data){
                                                             if(data.state==0){
                                                                 form.save(function(ret) {
                                                                     if (ret == -1) {
                                                                         layer.alert("数据保存失败，请重试！");
                                                                     } else {
                                                                         layer.msg("数据已保存！");
                                                                     }
                                                                 });
                                                             }
                                                             else{
                                                                 layer.msg("此账号已存在！");
                                                             }
                                                         });
		                 			    			 }
		                 			    			 else{
		                 			    			     form.save(function(ret) {
                                                             if (ret == -1) {
                                                                 layer.alert("数据保存失败，请重试！");
                                                             } else {
                                                                 layer.msg("数据已保存！");
                                                             }
                                                         });
		                 			    			 }
		                 			    		 }
		                 			    	 }
		                 			     }
		                 			 ]}
    }

	var form;
    $(document).ready(function(){
    	form = new FormView("formview",formSetting);
    	form.init();

    	var id='${param.id}';
    	if(id!=null&&id!=""){
    	   form.loadData(id, "User");
    	   $("input[name=userCode]").attr("disabled","disabled");

    	}

		ajustHeight();
    });

    var $$ = function(func){
        if (document.addEventListener) {
            window.addEventListener("load", func, false);
        }
        else if (document.attachEvent) {
            window.attachEvent("onload", func);
        }
    }
    $$(function(){


    });
    //-->
</SCRIPT>
</head>

<body>

<div id="formview0" class="rbox1"></div>
<div id="formview" class="rbox1"></div>
<div id="list" class="rbox2"></div>
<div id="fmUploadImg" style="display:none">
    <form method="post" enctype="multipart/form-data" name="form1" id="form1">
        <table>
            <tr>
                <td style="padding:20px 0 0 20px;">
                    <input type="file" name="userfile" id="inputImg" />
                </td>
            </tr>
        </table>
    </form>
</div>
<script type="text/javascript" src="<%=path %>/static/js/underscore.js"></script>
<script type='text/javascript' src='<%=path %>/static/My97DatePicker/WdatePicker.js'></script>
<script type='text/javascript' src='<%=path %>/dwr/engine.js'></script>
<script type='text/javascript' src='<%=path %>/dwr/util.js'></script>
<script type='text/javascript' src='<%=path %>/dwr/interface/BaseDwr.js'></script>

</body>
</html>